import Vue from 'vue'
import Vuex from 'vuex/dist/vuex.js'
console.log(Vuex)

Vue.use(Vuex)
const moduleA = {
  state: {
    count:100
  },
  mutations: {
    increment (state) {
      // 变更状态
      state.count++
    }
  },
  actions: { 
    increment (context) {
      context.commit('increment')
    } 
  }
}

const moduleB = {
  state: {
    count:1
  },
  mutations: {
    increment2(state) {
      // 变更状态
      state.count++
    }
  },
  actions: { 
    increment2 (context) {
      context.commit('increment2')
    } 
  }
}

export default new Vuex.Store({
  modules: {
    a: moduleA,
    b: moduleB
  }
})